﻿/**
 * File:   border_text.h
 * Author: 
 * Brief:  
 *
 * Copyright (c) 2024 - 2024 
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * License file for more details.
 *
 */

/**
 * History:
 * ================================================================
 * 2024-10-20  created
 *
 */


#ifndef TK_BORDER_TEXT_H
#define TK_BORDER_TEXT_H

#include "base/widget.h"

BEGIN_C_DECLS
/**
 * @class border_text_t
 * @parent widget_t
 * @annotation ["scriptable","design","widget"]
 * 
 * 在xml中使用"border\_text"标签创建控件。如：
 *
 * ```xml
 * <!-- ui -->
 * <border_text name="border_text" w="238" h="80" style:normal:font_size="80" style:normal:text_color="#00B050" style:normal:selected_text_color="#FFFFFF" style:normal:grid_color="#FFFFFF" style:normal:font_name="Inter_18pt_Bold" style:normal:text_align_h="left" style:normal:text_align_v="middle" text="29.5℃"/>
 * ```
 *
 * 可用通过style来设置控件的显示风格，如字体的大小和颜色等等。如：
 * 
 * ```xml
 * <!-- style -->
 * <border_text>
 *   <style name="default" font_size="32">
 *     <normal text_color="black" />
 *   </style>
 * </border_text>
 * ```
 */
typedef struct _border_text_t {
  widget_t widget;


} border_text_t;

/**
 * @method border_text_create
 * @annotation ["constructor", "scriptable"]
 * 创建border_text对象
 * @param {widget_t*} parent 父控件
 * @param {xy_t} x x坐标
 * @param {xy_t} y y坐标
 * @param {wh_t} w 宽度
 * @param {wh_t} h 高度
 *
 * @return {widget_t*} border_text对象。
 */
widget_t* border_text_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);

/**
 * @method border_text_cast
 * 转换为border_text对象(供脚本语言使用)。
 * @annotation ["cast", "scriptable"]
 * @param {widget_t*} widget border_text对象。
 *
 * @return {widget_t*} border_text对象。
 */
widget_t* border_text_cast(widget_t* widget);





#define WIDGET_TYPE_BORDER_TEXT "border_text"

#define BORDER_TEXT(widget) ((border_text_t*)(border_text_cast(WIDGET(widget))))

/*public for subclass and runtime type check*/
TK_EXTERN_VTABLE(border_text);

END_C_DECLS

#endif /*TK_BORDER_TEXT_H*/
